<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>Scm执行器</title>
    <link href="static/styles/bootstrap.min.css" rel="stylesheet">
    <link href="static/styles/index.css" rel="stylesheet">
</head>
<body>
<!-- 侧滑菜单 -->
<nav class="sidebar" id="sidebar">
    <div class="sidebar-sticky">
        <ul class="nav flex-column">
            <li class="nav-item">
                <a class="nav-link" index="idx_2">
                    授权支付表权限(GRANT ... TO)
                </a>
                <a class="nav-link" index="idx_3">
                    撤销支付表权限(REVOKE ... FROM)
                </a>
                <a class="nav-link" index="idx_18">
                    授权公告表权限(GRANT ... TO)
                </a>
                <a class="nav-link" index="idx_19">
                    撤销公告表权限(REVOKE ... FROM)
                </a>
                <a class="nav-link" index="idx_7">
                    查询慢SQL(SELECT PROCESSLIST)
                </a>
                <a class="nav-link" index="idx_1">
                    修改密码(ALTER ... IDENTIFIED)
                </a>
                <!--                <a class="nav-link" index="idx_4">-->
                <!--                    授权所有表和权限(GRANT ALL)-->
                <!--                </a>-->
                <a class="nav-link" index="idx_5">
                    查看用户所有权限(SHOW GRANTS)
                </a>
                <!--                <a class="nav-link" index="idx_6">-->
                <!--                    查询主从状态(SHOW ... STATUS)-->
                <!--                </a>-->
                <a class="nav-link" index="idx_17">
                    查库所有表(SHOW TABLE_SCHEMA)
                </a>

                <!--                <a class="nav-link" index="idx_16">-->
                <!--                    快捷查询语句(SELECT * FROM)-->
                <!--                </a>-->
                <a class="nav-link" index="idx_6">
                    查询连接数(SELECT ... THREADS)
                </a>
                <!--                <a class="nav-link" index="idx_8">-->
                <!--                    查询库容量(SELECT ... SCHEMA)-->
                <!--                </a>-->
                <a class="nav-link" index="idx_9">
                    MySQL锁等待(SELECT ... TRX)
                </a>
                <a class="nav-link" index="idx_10">
                    查询表索引(SHOW INDEX FROM)
                </a>
                <a class="nav-link" index="idx_11">
                    索引创建(CREATE INDEX ... ON)
                </a>
                <a class="nav-link" index="idx_12">
                    查询建表(SHOW CREATE TABLE)
                </a>

                <a class="nav-link" index="idx_13">
                    查询审计(GREP KEYWORD LOG)
                </a>
                <a class="nav-link" index="idx_14">
                    查看系统参数(SHOW VARIABLES)
                </a>
            </li>
        </ul>
    </div>
    <div class="card panel-card">
        <div class="card-body">
            <div class="row">
                <div class="col">
                    <div class="target target-header">
                        记账总额
                    </div>
                    <div class="target target-body" id="debts_total">
                        ¥0
                    </div>
                </div>
                <div class="col">
                    <div class="target target-header">
                        记账余额
                    </div>
                    <div class="target target-body" id="debts_remain">
                        ¥0
                    </div>
                </div>
                <div class="col">
                    <div class="target target-header">
                        记账金额
                    </div>
                    <div class="target target-body" id="debts_amount">
                        ¥0
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col">
                    <div class="target target-header">
                        记账期数
                    </div>
                    <div class="target target-body" id="debts_count">
                        第0期
                    </div>
                </div>
                <div class="col">
                    <div class="target target-header">
                        记账日期
                    </div>
                    <div class="target target-body" id="debts_date">
                        00000000
                    </div>
                </div>
                <div class="col">
                    <div class="target target-header">
                        记账备注
                    </div>
                    <div class="target target-body" id="debts_remark">
                        手工记账
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="card deploy-card">
        <div class="card-body">
            <div class="row">
                <div class="col">
                    <button id="deployServerBtn" type="button" class="btn btn-danger w-100">服务更新</button>
                </div>
                <div class="col">
                    <button id="deployWgtBtn" type="button" class="btn btn-info w-100">APP更新</button>
                </div>
            </div>

        </div>
    </div>
</nav>
<h5 class="text-fff middle-title">
    <svg id="authInputTrigger" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="bi bi-list svg6"
         viewBox="0 0 16 16">
        <path fill-rule="evenodd"
              d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z"/>
    </svg>
    <a href="tg://" class="text-fff">脚本执行器</a>
    <div id="clickToRemoveTask" class="dropdown">
        <svg id="clickToRemoveTask" xmlns="http://www.w3.org/2000/svg" fill="currentColor"
             class="bi bi-shield-fill-check svg5 dropdown-toggle" viewBox="0 0 16 16" data-toggle="dropdown"
             aria-expanded="false">
            <path fill-rule="evenodd"
                  d="M8 0c-.69 0-1.843.265-2.928.56-1.11.3-2.229.655-2.887.87a1.54 1.54 0 0 0-1.044 1.262c-.596 4.477.787 7.795 2.465 9.99a11.777 11.777 0 0 0 2.517 2.453c.386.273.744.482 1.048.625.28.132.581.24.829.24s.548-.108.829-.24a7.159 7.159 0 0 0 1.048-.625 11.775 11.775 0 0 0 2.517-2.453c1.678-2.195 3.061-5.513 2.465-9.99a1.541 1.541 0 0 0-1.044-1.263 62.467 62.467 0 0 0-2.887-.87C9.843.266 8.69 0 8 0zm2.146 5.146a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7.5 7.793l2.646-2.647z"/>
        </svg>
        <div class="dropdown-menu"></div>
    </div>
</h5>
<div class="container mt-3 mb-3">
    <div class="card">
        <div class="card-body">
            <div class="card-title"><span class="badge badge-pill svg1">请求授权</span></div>
            <form>
                <div class="form-group mb-0">
                    <input type="text" class="form-control" id="authInput" name="auth" placeholder="请输入"
                           autocomplete="off"/>
                </div>
            </form>
        </div>
    </div>
    <div class="card mt-3">
        <div class="card-body">
            <div class="card-title"><span class="badge badge-pill svg2">脚本管理</span></div>
            <div class="input-group mb-3">
                <div class="custom-file">
                    <form id="uploadForm">
                        <input type="file" class="custom-file-input" id="fileInput" name="file" accept="*" capture="none" autocomplete="off" multiple>
                        <label class="custom-file-label" for="fileInput">请选择</label>
                    </form>
                </div>
            </div>
            <div class="form-group mb-3">
                <form id="scriptForm">
                    <textarea class="form-control" id="scriptInput" rows="3" placeholder="快捷输入" autocomplete="off"></textarea>
                </form>
            </div>
            <div class="row">
                <div class="col">
                    <button id="cleanDataBtn" type="button" class="btn btn-danger w-100 mt-1">清洗</button>
                </div>
                <div class="col">
                    <button id="exportDataBtn" type="button" class="btn btn-warning w-100 mt-1">导出</button>
                </div>
                <div class="col">
                    <button id="uploadBtn" type="button" class="btn btn-secondary w-100 mt-1">上传</button>
                </div>
            </div>
        </div>
    </div>
    <div id="responseMessage" class="mb-3 mt-3 text-center"></div>
    <div class="card">
        <div class="card-body">
            <div class="card-title" id="selectAll"><span class="badge badge-pill svg3">环境选择</span></div>
            <form id="executeForm">
                <div class="form-group">
                    <div class="row mb-3">
                        <div class="col">
                            <div class="form-check">
                                <input class="form-check-input" type="checkbox" id="gridCheck2" name="mec02">
                                <label class="form-check-label" for="gridCheck2">
                                    MEC02
                                </label>
                            </div>
                        </div>
                        <div class="col">
                            <div class="form-check">
                                <input class="form-check-input" type="checkbox" id="gridCheck3" name="mec03">
                                <label class="form-check-label" for="gridCheck3">
                                    MEC03
                                </label>
                            </div>
                        </div>
                        <div class="col">
                            <div class="form-check">
                                <input class="form-check-input" type="checkbox" id="gridCheck4" name="mec04">
                                <label class="form-check-label" for="gridCheck4">
                                    MEC04
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class="row mb-3">
                        <div class="col">
                            <div class="form-check">
                                <input class="form-check-input" type="checkbox" id="gridCheck6" name="mec06">
                                <label class="form-check-label" for="gridCheck6">
                                    MEC06
                                </label>
                            </div>
                        </div>
                        <div class="col">
                            <div class="form-check">
                                <input class="form-check-input" type="checkbox" id="gridCheck15" name="mec15">
                                <label class="form-check-label" for="gridCheck15">
                                    MEC15
                                </label>
                            </div>
                        </div>
                        <div class="col">
                            <div class="form-check">
                                <input class="form-check-input" type="checkbox" id="gridCheck16" name="mec16">
                                <label class="form-check-label" for="gridCheck16">
                                    MEC16
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="row mb-3">
                        <div class="col">
                            <div class="form-check">
                                <input class="form-check-input" type="checkbox" id="gridCheck17" name="mec17">
                                <label class="form-check-label" for="gridCheck17">
                                    MEC17
                                </label>
                            </div>
                        </div>
                        <div class="col">
                            <div class="form-check">
                                <input class="form-check-input" type="checkbox" id="gridCheck18" name="mec18">
                                <label class="form-check-label" for="gridCheck18">
                                    MEC18
                                </label>
                            </div>
                        </div>
                        <div class="col">
                            <div class="form-check">
                                <input class="form-check-input" type="checkbox" id="gridCheck19" name="mec19">
                                <label class="form-check-label" for="gridCheck19">
                                    MEC19
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class="row mb-3">
                        <div class="col">
                            <div class="form-check">
                                <input class="form-check-input" type="checkbox" id="gridCheck20" name="mec20">
                                <label class="form-check-label" for="gridCheck20">
                                    MEC20
                                </label>
                            </div>
                        </div>
                        <div class="col">
                            <div class="form-check">
                                <input class="form-check-input" type="checkbox" id="gridCheck21" name="mec21">
                                <label class="form-check-label" for="gridCheck21">
                                    MEC21
                                </label>
                            </div>
                        </div>
                        <div class="col">
                            <div class="form-check">
                                <input class="form-check-input" type="checkbox" id="gridCheck22" name="mec22">
                                <label class="form-check-label" for="gridCheck22">
                                    MEC22
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class="row mb-3">
                        <div class="col">
                            <div class="form-check">
                                <input class="form-check-input" type="checkbox" id="gridCheck23" name="mec23">
                                <label class="form-check-label" for="gridCheck23">
                                    MEC23
                                </label>
                            </div>
                        </div>
                        <div class="col">
                            <div class="form-check">
                                <input class="form-check-input" type="checkbox" id="gridCheck24" name="mec24">
                                <label class="form-check-label" for="gridCheck24">
                                    MEC24
                                </label>
                            </div>
                        </div>
                        <div class="col">
                            <div class="form-check">
                                <input class="form-check-input" type="checkbox" id="gridCheck25" name="mec25">
                                <label class="form-check-label" for="gridCheck25">
                                    MEC25
                                </label>
                            </div>
                        </div>
                        <!--                        <div class="col">-->
                        <!--                            <div class="form-check">-->
                        <!--                                <input class="form-check-input" type="checkbox" id="gridCheck31" name="mvd31" disabled>-->
                        <!--                                <label class="form-check-label" for="gridCheck31">-->
                        <!--                                    MVD31-->
                        <!--                                </label>-->
                        <!--                            </div>-->
                        <!--                        </div>-->
                        <!--                        <div class="col">-->
                        <!--                            <div class="form-check">-->
                        <!--                                <input class="form-check-input" type="checkbox" id="gridCheck32" name="svd32" disabled>-->
                        <!--                                <label class="form-check-label" for="gridCheck32">-->
                        <!--                                    SVD32-->
                        <!--                                </label>-->
                        <!--                            </div>-->
                        <!--                        </div>-->
                    </div>
                </div>
                <div class="row">
                    <div class="col">
                        <button id="shellBtn" type="button" class="btn btn-secondary w-100 mt-1">SSH</button>
                    </div>
                    <div class="col">
                        <button id="auditBtn" type="button" class="btn btn-audit w-100 mt-1">审核</button>
                    </div>
                    <div class="col">
                        <button id="executeBtn" type="submit" class="btn btn-danger w-100 mt-1">执行</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="card mt-3 mb-3">
        <div class="card-body">
            <div class="card-title"><span class="badge badge-pill svg4">日志详情</span></div>
            <div class="text-left" id="logger"></div>
            <button id="downloadLog" type="button" class="btn btn-secondary w-100">下载日志</button>
        </div>
    </div>
</div>

<!--u用于测试二级页面的样式
<div class="detail-panel">
    <div class="detail-header">文件详情</div>
    <div class="detail-content">
    select case d.trx_id when d.blocking_trx_id then d.id end as thread, d.ID id,d.db,d.TIME,d.trx_id,d.blocking_trx_id,d.Info from (select c.ID,c.db,c.TIME,a.trx_id,b.blocking_trx_id,c.Info from information_schema.INNODB_TRX a,(select min(blocking_trx_id) blocking_trx_id,requesting_trx_id from information_schema.INNODB_LOCK_WAITS group by requesting_trx_id) b, information_schema.PROCESSLIST c where a.trx_id=b.requesting_trx_id  and a.trx_mysql_thread_id=c.id union all select distinct c.ID,c.db,c.TIME,a.trx_id,b.blocking_trx_id,c.Info from information_schema.INNODB_TRX a,(select min(blocking_trx_id) blocking_trx_id,requesting_trx_id from information_schema.INNODB_LOCK_WAITS group by requesting_trx_id) b, information_schema.PROCESSLIST c where a.trx_id=b.blocking_trx_id  and a.trx_mysql_thread_id=c.id )d order by blocking_trx_id,id;
    </p>
</div>-->


<input type="hidden" id="uploadedKey" value="">

<script src="static/scripts/jquery-3.3.1.slim.min.js"></script>
<script src="static/scripts/popper.min.js"></script>
<script src="static/scripts/bootstrap.min.js"></script>
<script>
    let ScmHosts = {
        "亚马逊节点": "http://43.199.201.251:58205"
    };
    // 节点
    let dropDownHtml = "";
    Object.keys(ScmHosts).forEach(key => {
        dropDownHtml += '<a class="dropdown-item" href="#" key="' + key + '" value="' + key + '">' + key + ' (ping 检测...) </a>';
    });
    dropDownHtml += '<a class="dropdown-item set-drop-down"> <input type="text" class="form-control" name="setNode" placeholder="43.199.201.251" autocomplete="off"><button type="button" id="setNodeNow" class="btn btn-secondary w-100">设置</button></a>'
    $(".dropdown-menu").html(dropDownHtml);

    // 默认节点
    let hostName = ScmHosts["亚马逊节点"];
    $("input[name='setNode']").val(hostName.substring(7, hostName.length - 6));
    let updateServer = "http://47.99.155.172:8205";
</script>
<script src="static/config.js"></script>
<script src="static/update.js"></script>
<script src="static/function.js"></script>
<script src="static/index.js"></script>
</body>
</html>
